package lzyc.pointsManagement.web.controller.business;

import lzyc.pointsManagement.business.activity.dto.ActivityApplyDto;
import lzyc.pointsManagement.business.course.dto.CourseInfoDto;
import lzyc.pointsManagement.business.service.CourseInfoService;
import lzyc.pointsManagement.common.core.page.PageDomain;
import lzyc.pointsManagement.common.response.ResponseMessage;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/api/v1/lesson")
@RestController
public class CourseController {

    CourseInfoService courseInfoService;

    CourseController(CourseInfoService courseInfoService) {
        this.courseInfoService = courseInfoService;
    }

    @PostMapping("/add")
    @ResponseBody
    public ResponseMessage courseAdd(@RequestBody CourseInfoDto dto) {
        return courseInfoService.courseAdd(dto);
    }

    @PostMapping("/update")
    @ResponseBody
    public ResponseMessage courseUpdate(@RequestBody CourseInfoDto dto) {
        return courseInfoService.courseUpdate(dto);
    }

    @PostMapping("/delete")
    @ResponseBody
    public ResponseMessage courseDelete(@RequestParam String id) {
        return courseInfoService.courseDelete(id);
    }

    @PostMapping("/list")
    @ResponseBody
    public ResponseMessage courseDelete(@RequestBody PageDomain pageDomain) {
        return courseInfoService.getCourseListByPage(pageDomain);
    }

    @PostMapping("/detail")
    @ResponseBody
    public ResponseMessage getCourseDetail(@RequestParam String id) {
        return courseInfoService.getCourseDetail(id);
    }
}
